﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:SDZ="clr-namespace:SuperDeepZoom;assembly=SuperDeepZoom"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
>

    <Style TargetType="SDZ:SpecialImageOverlayItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="SDZ:SpecialImageOverlayItem">
                    <Grid x:Name="SpecialOverlayRoot">
                        <!--
                        
                            Place your item overlay stuff here: For example
                            <TextBlock Text="{Binding Path=Value.Title}" Height="Auto" Foreground="#FFFFFFFF"/>
                        
                            What ever object you passed in as the ImageContext will be available here as the Value... 
                        
                        -->

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="SDZ:SpecialImageOverlay">                       
       
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="SDZ:SpecialImageOverlay">
                    <Grid x:Name="grid">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="VisibilityStates">
                                <vsm:VisualStateGroup.Transitions>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Visible">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="00:00:00.0010000">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.995"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>

                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Invisible">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.6000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>

                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <ItemsPresenter/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--FlyThroughOverlayStyle allows customisation of the flythrough overlay-->
    <Style TargetType="SDZ:FlyThroughOverlayItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="SDZ:FlyThroughOverlayItem">

                    <Grid x:Name="FlyThroughRoot" Height="20">

                        <!--Customise the overlay line here-->
                        <!--Ensure your controls stretch 100% wide, as the size will be altered
                                by code -->
                        <!--<Rectangle Height="10" VerticalAlignment="Center" Fill="Green" Margin="0,0,0,0" Width="Auto" />
                            <Ellipse HorizontalAlignment="Left" Margin="-10,0,0,0" Width="20" Fill="Red" Stroke="#FF000000" Height="20" VerticalAlignment="Center"/>
                            <Ellipse HorizontalAlignment="Right" Margin="0,0,-10,0" Width="20" Fill="Red" Stroke="#FF000000" Height="20" VerticalAlignment="Center"/>-->

                    </Grid>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="SDZ:FlyThroughOverlay">

        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="SDZ:FlyThroughOverlay">
                    <Grid x:Name="grid">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="VisibilityStates">
                                <vsm:VisualStateGroup.Transitions>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Visible">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="00:00:00.0010000">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.995"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>

                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Invisible">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.5000000">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>

                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <ItemsPresenter/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="SDZ:SuperDeepZoom">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="SDZ:SuperDeepZoom">
                    <Grid>

                        <!--This is a control that is referenced by the TemplatePart in SuperDeepZoom.cs (right at the top)-->
                        <MultiScaleImage x:Name="RootMultiScaleImage"/>

                        <!--This is a control that is referenced by the TemplatePart in SuperDeepZoom.cs (right at the top)-->
                        <SDZ:FlyThroughOverlay x:Name="FlyThroughOverlay"/>
                        <SDZ:SpecialImageOverlay x:Name="SpecialImageOverlay"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>